<%@ page language="java" pageEncoding="utf-8"%>
<%@include file="/commons/taglib.jsp"%>

<html>
<head>
	<script type="text/javascript" src="${rootPath}/js/jquery.js"></script>
	<script type="text/javascript">
		
		function submitForm(){
			var form = document.getElementById( "liansaiForm" );
			form.action="${rootPath}/liansai_list.action";
			form.submit();
		}
		
		//保存数据	
		function saveLianSaiData(){
			var form = document.getElementById( "liansaiForm" );
			form.action="${rootPath}/liansai_save.action";
			form.submit();
		}
			
		//更新联赛数据
		function updateLianSaiData(){
			var form = document.getElementById( "liansaiForm" );
			form.action="${rootPath}/liansai_update.action";
			form.submit();
		}
		
		//生成一个赛季的球队列表
		function saveFootballTeam( lianSaiInfoId ){
			var form = document.getElementById( "liansaiForm" );
			form.action="${rootPath}/liansai_saveFootballTeam.action?lianSaiInfoId="+lianSaiInfoId;
			form.submit();
		}
		
		
		//生成一个赛季的球队对阵关系
		function saveFootballTeamDZ( lianSaiInfoId ){
			var form = document.getElementById( "liansaiForm" );
			form.action="${rootPath}/liansai_saveFootballTeamDZ.action?lianSaiInfoId="+lianSaiInfoId;
			form.submit();
		}
		
		//统计积分
		function tjJiFen( lianSaiId ){
			var form = document.getElementById( "liansaiForm" );
			form.action="${rootPath}/liansai_tjJifen.action?lianSaiId="+lianSaiId;
			form.submit();
		}
		
		//统计进球
		function tjJinQiu( lianSaiId ){
			var form = document.getElementById( "liansaiForm" );
			form.action="${rootPath}/liansai_tjJinQiu.action?lianSaiId="+lianSaiId;
			form.submit();
		}
		
		//统计主力
		function tjZhuLi( lianSaiId ){
			var form = document.getElementById( "liansaiForm" );
			form.action="${rootPath}/liansai_tjZhuLi.action?lianSaiId="+lianSaiId;
			form.submit();
		}
		
		//统计红黄牌
		function tjHongHuangPai( lianSaiId ){
			var form = document.getElementById( "liansaiForm" );
			form.action="${rootPath}/liansai_tjHongHuangPai.action?lianSaiId="+lianSaiId;
			form.submit();
		}
		
		//统计所有数据
		function tjAllData( lianSaiId ){
			var form = document.getElementById( "liansaiForm" );
			form.action="${rootPath}/liansai_tjAllData.action?lianSaiId="+lianSaiId;
			form.submit();
		}
	</script>
	
	<style type="text/css">		
		.tip{
			color:#ff0000;
			font-size:30px;
		}
	</style>
	
</head>
<body>
	<center>
		<form action="${rootPath}/liansai_list.action" method="post" name="liansaiForm" id="liansaiForm" >
			足球赛事年份：
			<select name="lianSaiYearId" id="lianSaiYearId" onchange="submitForm()">
				<c:forEach items="${lianSaiYearList}" var="lianSaiYear">
					<option value="${lianSaiYear.id}" <c:if test="${ lianSaiYearId == lianSaiYear.id }">selected</c:if> >
						${lianSaiYear.liansaiYear}
					</option>
				</c:forEach>
			</select><br/>
			<table width="100%">				
				<tr>
					<th align="center" width="10%" >名称</th>
					<th align="center" width="10%" >轮次</th>
					<th align="center" width="30%" >bet007_url</th>
													
		 			<c:if test="${ flag == 2 }">
		 				<th align="center" width="10%" >当前轮次</th>
						<th align="center" width="40%">操作</th>
					</c:if>
					
				</tr>
				
				<c:forEach items="${lianSaiInfoList}" var="lianSaiInfo">
					<tr>
						<td align="center" width="10%">${lianSaiInfo.lianSai.chineseName}</td>
						<td align="center" width="10%">${lianSaiInfo.lianSai.sumLunci}</td>
												
						<td align="center" width="35%" >
							<input size="60" type="text" name="bet007_url_${lianSaiInfo.id}" value="${lianSaiInfo.urlBet007}" />
							
						</td>
						<td align="center" width="10%">
							<input size="10" type="text" name="lunci_${lianSaiInfo.id}" value="${lianSaiInfo.lunci}" />
							
						</td>
						<td align="center" width="40%" >
							<input type="hidden" name="id_${lianSaiInfo.id}" value="${lianSaiInfo.id}" />
							<a href="javascript:void(0);" onclick="javascript:saveFootballTeam('${lianSaiInfo.id}')">生成球队列表</a>
							<br/>
							<a href="javascript:void(0);" onclick="javascript:saveFootballTeamDZ('${lianSaiInfo.id}')">生成对阵数据</a>
							
							<span style="display: none;">
								<a href="javascript:void(0);" onclick="javascript:tjJiFen('${lianSaiInfo.lianSai.id}')">球队积分统计</a>
								<a href="javascript:void(0);" onclick="javascript:tjJinQiu('${lianSaiInfo.lianSai.id}')">球队进球统计</a>
								<br/>
								<a href="javascript:void(0);" onclick="javascript:tjZhuLi('${lianSaiInfo.lianSai.id}')">球队主力统计</a>
								<a href="javascript:void(0);" onclick="javascript:tjHongHuangPai('${lianSaiInfo.lianSai.id}')">球员得牌统计</a>
							</span>
							
							<br/>
							<a href="javascript:void(0);" onclick="javascript:tjAllData('${lianSaiInfo.lianSai.id}')">数据统计</a>
							<br/><br/>
						</td>
						
					</tr>
				</c:forEach>
				
				<c:forEach items="${lianSaiList}" var="lianSai">
					<tr>
						<td align="center" width="10%">${lianSai.chineseName}</td>
						<td align="center" width="10%">${lianSai.sumLunci}</td>
						
						<td align="center" width="80%" >
							<input size="60" type="text" name="bet007_url_${lianSai.id}" value="" />
							<input size="20" type="hidden" name="id_${lianSai.id}" value="${lianSai.id}" />
						</td>
								
					</tr>
				</c:forEach>
				
				<tr>
					<td colspan="7" align="center">
						<c:if test="${ flag == 1 }">
							<input type="button" name="edit" onclick="javascript:saveLianSaiData()" value="保存数据" />
						</c:if>
						<c:if test="${ flag == 2 }">
							<input type="button" name="update" onclick="javascript:updateLianSaiData()" value="更新数据" />
						</c:if>
					</td>
				</tr>
				
			</table>
		</form>
	</center>
</body>
</html>